package cn.pugle.oj.leetcode;

import cn.pugle.oj.catalog.BitProblem;
import cn.pugle.oj.catalog.Unknown;

/**
 * @author tzp
 * @since 2020/11/11
 */
public class LC461 implements BitProblem {

    int mask = 1;
    public int hammingDistance(int x, int y) {
        int result = 0;
        for (int i = 0; i < 31; i++) {
            if ((x & mask) != (y & mask)) result++;
            x = x >>> 1;
            y = y >>> 1;
        }
        return result;
    }

    public static void main(String[] args) {
        System.out.println(new LC461().hammingDistance(14, 4));
    }
}
